/*
Purpose: Get national NAEP numbers used in the paper
*/

global mean92 266.869669674271 //source of this is raw/state_scale_score, national public 1992 mean
global sd92 36.3153155648024

global mean92_4 218.584407651333
global mean92_4 32.0908580455856

use "data/clean/math8_normed.dta", clear
tab state_name
sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==1990
sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==2019
di .389 + .141

di (273.132229-$mean92) / $sd92 // 273.132229 is 2022 score, normalizing this

di .3887321 - .17244954
di (.3887321 - .17244954) / (.3887321 + .1411443)

sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==1990
sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==2009

di .141 + .408 // national improvement from 1990 to 2009
di .549 * .080 // implied % improvement in earnings 
di .549 * .018 // implied % decline in teen motherhood
di .549 * .017 // implied % decline in incarceration

sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==1990
sum scale_score_norm if state_name=="NATIONAL PUBLIC"&year==2013

di .141 + .461

import excel "data/raw/NAEP math g8 by race.xls", cellrange("A9:E4467") first clear
ren Year year
ren Jurisdiction state_name
ren Raceethnicityusedtoreporttr race
ren Averagescalescore scale_score

drop if scale_score=="—"|scale_score=="‡"
destring scale_score, replace
gen scale_score_norm = (scale_score - $mean92) / $sd92

sum scale_score_norm if substr(year,1,4)=="1990"&race=="White"
sum scale_score_norm if substr(year,1,4)=="1990"&race=="Black"
di .0606051 + .846634